package com.oncliedisk.administrator.utils;

import android.content.Context;

import com.oncliedisk.administrator.content.OnlineConfig;
import com.vdisk.android.VDiskAuthSession;
import com.vdisk.net.VDiskAPI;
import com.vdisk.net.session.AppKeyPair;
import com.vdisk.net.session.Session;

/**
 * Created by Administrator on 2015/12/11.
 */
public class OnlineUtils {


    /**
     * 返回Session对象
     *
     * @param context
     * @return
     */
    public static VDiskAuthSession getSession(Context context) {
        AppKeyPair appKeyPair = new AppKeyPair(OnlineConfig.CONSUMER_KEY, OnlineConfig.CONSUMER_SECRET);
        VDiskAuthSession session = VDiskAuthSession.getInstance(context, appKeyPair,
                Session.AccessType.APP_FOLDER);
        return session;
    }
    public static VDiskAPI<VDiskAuthSession> getMapi(Context context) {
        AppKeyPair appKeyPair = new AppKeyPair(OnlineConfig.CONSUMER_KEY,
                OnlineConfig.CONSUMER_SECRET);

        VDiskAuthSession session = VDiskAuthSession.getInstance(context, appKeyPair,
                Session.AccessType.APP_FOLDER);

        VDiskAPI<VDiskAuthSession> mApi = new VDiskAPI<VDiskAuthSession>(session);
        return mApi;
    }
}
